//
//  BFShOrderHeaderView.m
//  BeautyFood
//
//  Created by apple on 2020/5/5.
//  Copyright © 2020 stoneobs. All rights reserved.
//

#import "BFShOrderHeaderView.h"
@interface BFShOrderHeaderView()
@property(nonatomic, strong) STLabel                     *time_lable;/**<  */

@end
@implementation BFShOrderHeaderView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithReuseIdentifier:reuseIdentifier]) {
        [self stoneobs_ui_configSubView];
    }
    return self;
}
+ (CGFloat)stoneobs_ui_cell_height{
    return 50;
}
#pragma mark --configSubView
- (void)stoneobs_ui_configSubView{
    self.clipsToBounds = YES;
    self.backgroundColor = UIColor.clearColor;
    CGFloat cornerRadius = 8;
    
    UIView * whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, STONEOBS_UI_UISCREEN_WIDTH - 0, self.class.stoneobs_ui_cell_height + cornerRadius)];
    whiteView.backgroundColor = UIColor.whiteColor;
    whiteView.layer.cornerRadius = cornerRadius;
    whiteView.clipsToBounds = YES;
    [self addSubview:whiteView];
    
    
    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(12, 0, 200, self.class.stoneobs_ui_cell_height)
                                                                text:@"订单时间：2020-01-07 16:03"
                                                           textColor:STONEOBS_UI_FIRST_TEXT_COLOR
                                                                font:13
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [whiteView addSubview:stoneobs_ui_label];
        self.time_lable  = stoneobs_ui_label;
    });

    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(12, 0, 200, 22)
                                                                text:@"代付款"
                                                           textColor:FlatRed
                                                                font:10
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentCenter];
        [whiteView addSubview:stoneobs_ui_label];
        self.status_lable  = stoneobs_ui_label;
        stoneobs_ui_label.right = whiteView.width - 12;
        stoneobs_ui_label.layer.cornerRadius = stoneobs_ui_label.height / 2;
        stoneobs_ui_label.clipsToBounds = YES;
        stoneobs_ui_label.centerY = self.time_lable.centerY;
        stoneobs_ui_label.backgroundColor = [STONEOBS_UI_THEME_BACKGROUNDCOLOR colorWithAlphaComponent:0.1];
    });
    
}
- (void)setModel:(BFShOrderModel *)model{
    _model = model;
    self.time_lable.text = [NSString stringWithFormat:@"订单时间:%@",model.created_at];
    if (model.status.intValue == 0) {
        self.status_lable.text = @"待付款";
    }else{
        self.status_lable.text = @"已付款";
    }
    self.status_lable.text = model.cus_deal_status_string;
    [NSString stoneobs_fun_lableAutoAdjustWitdhWithLabel:self.status_lable];
    self.status_lable.width = self.status_lable.width + self.status_lable.height;
    self.status_lable.right = STONEOBS_UI_UISCREEN_WIDTH - 15;
    self.status_lable.textColor = STONEOBS_UI_THEME_BACKGROUNDCOLOR;
}
@end
